//
// Created by LH on 2017/8/28.
//

#include <iostream>

using namespace std;
int map[11][11];
int n, m;
int sum = 0;
int change[4][2] =
        {
                { 0, 1 },
                { 0, -1 },
                { 1, 0 },
                { -1, 0 } };
void dfs(int x, int y)
{
    for (int t = 0; t < 4; t++)
    {
        int nx = x + change[t][0];
        int ny = y + change[t][1];
        if (nx >= 0 && nx < n&&ny >= 0 && ny < m&&map[nx][ny]>0)
        {
            map[nx][ny] = -1;
            sum++;
            dfs(nx, ny);
        }
    }
    return;
}

int main()
{
    int  sx, sy;
    cin >> n >> m >> sx >> sy;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> map[i][j];
        }
    }
    dfs(sx, sy);
    cout << sum << endl;
    return 0;
}
/*

10 10 6 8
1 2 1 0 0 0 0 0 2 3
3 0 2 0 1 2 1 0 1 2
4 0 1 0 1 2 3 2 0 1
3 2 0 0 0 1 2 4 0 0
0 0 0 0 0 0 1 5 3 0
0 1 2 1 0 1 5 4 3 0
0 1 2 3 1 3 6 2 1 0
0 0 3 4 8 9 7 5 0 0
0 0 0 3 7 8 6 0 1 2
0 0 0 0 0 0 0 0 1 0
*/